<ul class="nav navbar-nav navbar-left">
    {% for item in category_pre %}
        <li><a href="{% url 'blog:category' item.id %}">{{ item.name|title }}</a></li>
    {% endfor %}

    {% if category_end %}
        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
               aria-expanded="false">其他 <span class="caret"></span></a>
            <ul class="dropdown-menu">
                {% for item in category_end %}
                    <li><a href="{% url 'blog:category' item.id %}">{{ item.name|title }}</a></li>
                    <li role="separator" class="divider"></li>
                {% endfor %}
            </ul>
        </li>
    {% endif %}
</ul>